package com.example.springboot.controller;

import com.example.springboot.config.bootcustomize.messageconverter.UserEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 消息转换器的测试
 *
 * @Author:ChenZhangKun
 * @Date: 2021/1/25 19:17
 */
@Controller
public class UserEntityController {
    @PostMapping("/test1")
    public @ResponseBody
    UserEntity userEntity(@RequestBody UserEntity userEntity) {
        return userEntity;
    }

    /**
     * 测试消息消息转换器CzkMessageConverter
     *
     * @return
     */
    @GetMapping("/test2")
    @ResponseBody
    public UserEntity userEntity_2() {
        UserEntity userEntity = new UserEntity();
        userEntity.setName("durant");
        userEntity.setAge(33);
        return userEntity;
    }
}
